import { create } from "zustand";
import { BannerType } from "../type/course";
interface PlayerStateType {
  show: boolean;
  popData: BannerType | null; //弹窗面板所需数据
  isPlay: boolean; //控制音频播放暂停
  bubbleShow: boolean; //控制胶囊气泡
  toggleShow: (arg: boolean) => void;
  changePopData: (arg: BannerType) => void;
  togglePlay: (arg: boolean) => void;
  toggleBubbleShow: (arg: boolean) => void;
}
export const usePlayerStore = create<PlayerStateType>((set) => ({
  show: false,
  popData: null,
  isPlay: false,
  bubbleShow: false,
  toggleShow(bool) {
    set({ show: bool });
  },
  changePopData(banner) {
    set({ popData: banner });
  },
  togglePlay(bool) {
    set({ isPlay: bool });
  },
  toggleBubbleShow(bool) {
    set({ bubbleShow: bool });
  },
}));
